/* 
 * Copyright (C)2008 Vladimir Hozjan vladimir.hozjan@gmail.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 */

/**
 * @file TetrisEngineTest.h  
 *
 * Declaration of tests for Tetris
 *
 * @author Vladimir Hozjan
 * @date   28.12.2008 
 *
 * @remarks VHOZ [28.12.2008]: file created
 */
#ifndef _TetrisEngineTest_
#define _TetrisEngineTest_

/////////////////////////////////////////////////////////////////////  LIBRARIES
#include <cppunit/extensions/HelperMacros.h>

class Tetris;

/**
 * @class TetrisEngineTest
 *
 * @brief Unit test Fixture
 *
 * @author Vladimir Hozjan, ITPSF2
 */
class TetrisEngineTest : public CppUnit::TestFixture {

public:
  void setUp();
  void tearDown();

  TetrisEngineTest() {};

private:
  CPPUNIT_TEST_SUITE( TetrisEngineTest );

  CPPUNIT_TEST( testElementShapes1 );  
  CPPUNIT_TEST( testElementShapes2 );  
  CPPUNIT_TEST( testElementShapes3 );  
  CPPUNIT_TEST( testElementShapes4 );  
  CPPUNIT_TEST( testElementShapes5 );  
  CPPUNIT_TEST( testElementShapes6 );  
  CPPUNIT_TEST( testElementShapes7 );  
  CPPUNIT_TEST( testMoveShapeLeft );  
  CPPUNIT_TEST( testMoveShapeRight );  
  CPPUNIT_TEST( testTurnLeft );  
  CPPUNIT_TEST( testTurnRight );  
  CPPUNIT_TEST( testNextMoveDown );
  CPPUNIT_TEST( testDrop );
  CPPUNIT_TEST( testFullLine );
  CPPUNIT_TEST( testElementChange );
  CPPUNIT_TEST( testPositionChange );
  CPPUNIT_TEST( stresTest );
  CPPUNIT_TEST( testIsGameOver );

  CPPUNIT_TEST_SUITE_END();

private:
  /* Test empty board*/

  /* Test shapes*/
  void testElementShapes1();       // Test element 1
  void testElementShapes2();       // Test element 2
  void testElementShapes3();       // Test element 3
  void testElementShapes4();       // Test element 4
  void testElementShapes5();       // Test element 5
  void testElementShapes6();       // Test element 6
  void testElementShapes7();       // Test element 7

  /* Test move left */
  void testMoveShapeLeft();

  /* Test move right */
  void testMoveShapeRight();

  /* Test turn left */
  void testTurnLeft();

  /* Test turn right */
  void testTurnRight();

  /* Test next move and move down */
  void testNextMoveDown();
  
  /* Test drop */
  void testDrop();
  
  /* Test full line */
  void testFullLine();

  /* Test position change*/
  void testPositionChange();

  /* Test element change*/
  void testElementChange();

  /* Stress test*/
  void stresTest();

  /* Test is game over*/
  void testIsGameOver();

  /* Other helper methods */
  /* Helper method for position change */
  void onPositionChange() {mPositionChange = true;};

  /* Helper method for element change method */
  void onElementChange() {mElementChange = true;};

  Tetris *mTetris;
  Tetris *mTetris1;
  Tetris *mTetris2;

  bool mPositionChange;
  bool mElementChange;

  double mScore;
  unsigned short mNumLines;
  unsigned short mLevel;
};


#endif // _itPairTest_h_